package com.gdk.ksoft.ui.customers.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gdk.ksoft.data.entry.tables.CustomerTable;

import java.util.List;

/**
 * Created by hel on 2014-12-22.
 * 客户信息列表数据适配器
 */
public class CustomerInfoAdapter extends BaseAdapter{

    private Context context;
    private List<CustomerTable> list;

    public CustomerInfoAdapter(Context context,List<CustomerTable> list){
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list == null?0:list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = View.inflate(context,android.R.layout.simple_list_item_1,null);
        ((TextView)view.findViewById(android.R.id.text1)).setText(list.get(position).mc);
        return view;
    }
}
